//
//  MyView.m
//  NBAApp
//
//  Created by 刘意明 on 16/12/1.
//  Copyright © 2016年 Manito. All rights reserved.
//

#import "MyView.h"

@implementation MyView

-(UITableView *)Mytable
{
    if (!_Mytable) {
        _Mytable = [[UITableView alloc]initWithFrame:CGRectMake(0, 200 , ScreenWidth, ScreenHeight) style:UITableViewStyleGrouped] ;
    }
    return _Mytable ;
}
//-(UIButton *)button1
//{
//    if (_button1) {
//        _button1 =[[UIButton alloc] initWithFrame:CGRectMake(100, 80, 100, 50)];
//        [_button1 setTitle:@"点击登录" forState:UIControlStateNormal];
//    }
//    return _button1;
//}
//-(UIButton *)button2
//{
//    if (_button2) {
//        _button2 =[[UIButton alloc] initWithFrame:CGRectMake(100, 40, 100, 20)];
//        [_button2 setImage:[UIImage imageNamed:@"人物.png"] forState:UIControlStateNormal];
//    }
//    return _button2;
//}
//button;
-(void)initButton:(UIButton*)btn{
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;//使图片和文字水平居中显示
    [btn setTitleEdgeInsets:UIEdgeInsetsMake(btn.imageView.frame.size.height ,-btn.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度，距离左边框减少imageView的宽度，距离下边框和右边框距离不变
    [btn setImageEdgeInsets:UIEdgeInsetsMake(0.0, 0.0,0.0, -btn.titleLabel.bounds.size.width)];//图片距离右边框距离减少图片的宽度，其它不边
}
//-(UIView *)MainView
//{
//    if (_MainView) {
//        _MainView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth , 500)];
//        _MainView.backgroundColor=[UIColor yellowColor];
//    }
//    return _MainView;
//}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.Mytable] ;
        [self addSubview:self.button1] ;
        [self addSubview:self.button2] ;
        [self addSubview:self.MainView];
    }
    return self;
}
@end
